ADF.AttrColorPropertyEditor = function(propDescriptor) {
        ADF.AttrColorPropertyEditor.superclass.constructor.call(this, propDescriptor);
    };
    ADF.AttrColorPropertyEditor.LABEL = "attrColorEditor";
    COM.util.defineClass(ADF.AttrColorPropertyEditor, AGEF.PropertyEditor, {
        createControl: function(propDescriptor) {
            var controlString =  '<div class="form-horizontal" style="margin-bottom:5px;"><div class="form-group" style="position: relative;">' +
            '<div class="col-sm-3" style="margin-left: 2px"><label style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap" for="'+propDescriptor.getName()+ '" class="control-label" title="'+propDescriptor.getHint()+'">'+propDescriptor.getTitle()+'</label></div>' +
            '<div class="col-sm-9" style="margin-left: -25px">' +
            '<input type="text" style="display:none;" class="form-control fontBgColor" id="'+propDescriptor.getName()+ '" value="'+propDescriptor.getValue()+ '">' +
            '</div></div></div>';
            var control = COM.util.HTMLUtil.createELement(controlString);
            this.control = control[0];
            var fontBgColor = COM.util.HTMLUtil.getChildren(this.control, ".fontBgColor");
            $(fontBgColor).spectrum({
                color:"#000000",
                flat:false,
                showInput:true,
                showInitial:true,
                allowEmpty:true,
                showAlpha:true,
                showPaletteOnly: true,
                hideAfterPaletteSelect:true,
                togglePaletteOnly: true,
                cancelText: "取消",
                chooseText:"确定",
                togglePaletteMoreText: "自定义颜色",
                togglePaletteLessText: "隐藏自定义",
                containerClassName: "fontBgCon",
                replacerClassName: "fontBgRep",
                preferredFormat: "rgb",
                palette: [
                   ["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],
                   ["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"],
                   ["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"],
                   ["#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd"],
                   ["#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0"],
                   ["#c00","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79"],
                   ["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],
                   ["#600","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]
                ],
                clearText:"清除颜色",
                noColorSelectedText:"透明",
                showButtons:true
            });
            $(fontBgColor).spectrum("set",$(fontBgColor).val());
            var fontBgRep = COM.util.HTMLUtil.getChildren(this.control, ".fontBgRep");
            $(fontBgRep).find(".sp-dd").remove();
        },
        getControl: function() {
            return this.control;
        },
        setValue: function(value) {
            if(value != this.getValue()) {
                COM.util.HTMLUtil.getChildren(this.control, ".fontBgColor").attr("value",value);
            }
        },
        getValue: function() {
            var value = COM.util.HTMLUtil.getChildren(this.control, ".fontBgColor").val();
            return value;
        },
        bindChangeHandler: function(handler) {
            COM.util.HTMLUtil.getChildren(this.control, ".fontBgColor").bind('change.spectrum', function(e,color) {
                var request = new AGEF.ChangeValueRequest();
                request.setPropertyName(this.propDescriptor.getName());
                request.setValue(color.toRgbString());
                handler(request);
            }.bind(this));
        }
    });